home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOB007.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-24  |  2KB  |  86 lines

  1. program DemoB007;
  2. {------------------------------------------------------------------------------
  3.                             DBase Memo File Lister
  4.                                    Sample 7
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.        This program demonstrates how dBase memo records may be listed
  16.        using Griffin Solutions units.
  17.  
  18.        The program initializes a dBase file object, opens the file, and
  19.        proceeds to list selected fields from each record along with its
  20.        memo record.
  21.  
  22. -------------------------------------------------------------------------------}
  23.  
  24. uses
  25.    CRT,
  26.    DOS,
  27.    GS_Date,
  28.    GS_dBase,
  29.    GS_DBFld,
  30.    GS_FileH,
  31.    GS_GenF;
  32. var
  33.    MyFile  : GS_dBFld_Objt;
  34.    CkFile  : file;
  35.    c       : char;
  36.  
  37.                      {Procedure to display the memo field}
  38.  
  39. procedure ShowTheMemo;
  40. var
  41.    i,
  42.    ml   : integer;
  43.  
  44. begin
  45.    MyFile.MemoGet(MyFile.FieldGet('COMMENTS'));
  46.    ml := MyFile.MemoLines;
  47.    if ml <> 0 then
  48.       for i := 1 to ml do
  49.          writeln(MyFile.MemoGetLine(i))
  50.       else writeln('[ EMPTY ]');
  51.    writeln;
  52. end;
  53.  
  54.                                {Main program}
  55.  
  56. begin
  57.    GS_Date_Century := true;     {Gives full century on date display (YYYY)}
  58.                                 {default is false for YY only.}
  59.    ClrScr;
  60.    if not GS_FileExists(CkFile,'DEMOB7.DBF') then
  61.    begin
  62.       writeln('Creating DEMOB7.DBF');
  63.       MakeTestData('DEMOB7', 20, true);
  64.       writeln('DEMOB7.DBF Created');
  65.       ClrScr;
  66.    end;
  67.  
  68.    MyFile.Init('DEMOB7');
  69.    MyFile.Open;
  70.    MyFile.MemoWidth(75);        {sets width of the memo line.  Default is 50}
  71.    MyFile.GetRec(Top_Record);
  72.    while not MyFile.File_EOF do
  73.    begin
  74.       ClrScr;
  75.       writeln(MyFile.FieldGet('LASTNAME'),', ',
  76.               MyFile.FieldGet('FIRSTNAME'));
  77.       ShowTheMemo;
  78.       write('Press any key....');
  79.       c := ReadKey;
  80.       writeln;
  81.       MyFile.GetRec(Next_Record); {Get the next sequential record}
  82.    end;
  83.    MyFile.Close;
  84. end.
  85.  
  86.